<?php
/**
 * 友情链接
 * User: jh
 * Date: 2018/3/22
 * Time: 22:43
 */
namespace frontend\widgets;
use common\models\Link;
use yii\bootstrap\Widget;

class LinkMenu extends Widget {

    private $view = '@frontend/views/widget/link.php';

    public $params = [];

    public function init()
    {
        $link = Link::find()->where(['status'=>1])
            ->orderBy('order desc,id desc')
            ->limit(20)
            ->asArray()
            ->all();
        $this->params['link'] = $link;
    }

    public function run()
    {
        echo $this->renderFile($this->view, $this->params);
    }
}